#ifndef __Display_h__
#define __Display_h__

uint BCD2BIN_INT(unsigned int c);
uint BIN2BCD_INT(unsigned int c);

void SetNumDisplay(unsigned char num,unsigned char n);
void Display_SetPage(void);
void Display_CurrentTemp(void);
void Display_CurrentTime(void);
void Display_CurrentKailiang(void);
void Display_CurrentGongwen(void);
void Display_CurrentHuiwen(void);
void Display_Mode(void);
void Display_Clean(void);
void ShowSignalFlag(void);
void Display_CommunicationSignal(void);
void Display_Flash(void);
void Display_CurrentGuanliang(void);
void Display_CurrentKaiDu(void);
void Display_CurrentHeat(void);
uchar BCD2BIN_CHAR(uchar c);
uchar BIN2BCD_CHAR(uchar c);
uint BCD2BIN_INT(unsigned int c);
uint BIN2BCD_INT(unsigned int c);

void ValveOpen(void);
void ValveClose(void);
void ControlValve(void);

extern const unsigned char Temp[16];


#define setM6_1            DisplayMapping[1]|=0x08;HT162X_WriteData(1,DisplayMapping[1])
#define setM6_0            DisplayMapping[1]&=0x07;HT162X_WriteData(1,DisplayMapping[1])

#define setKaiLiang_1      DisplayMapping[3]|=0x08;HT162X_WriteData(3,DisplayMapping[3])
#define setKaiLiang_0      DisplayMapping[3]&=0x07;HT162X_WriteData(3,DisplayMapping[3])

#define setP_1             DisplayMapping[4]|=0x08;HT162X_WriteData(4,DisplayMapping[4])
#define setP_0             DisplayMapping[4]&=0x07;HT162X_WriteData(4,DisplayMapping[4])

#define setM7_1           DisplayMapping[11]|=0x08;HT162X_WriteData(11,DisplayMapping[11])
#define setM7_0           DisplayMapping[11]&=0x07;HT162X_WriteData(11,DisplayMapping[11])

#define setDiZhi_1        DisplayMapping[13]|=0x01;HT162X_WriteData(13,DisplayMapping[13])
#define setDiZhi_0        DisplayMapping[13]&=0x0e;HT162X_WriteData(13,DisplayMapping[13])

#define setGuanLiang_1    DisplayMapping[13]|=0x02;HT162X_WriteData(13,DisplayMapping[13])
#define setGuanLiang_0    DisplayMapping[13]&=0x0d;HT162X_WriteData(13,DisplayMapping[13])

#define setH_1            DisplayMapping[14]|=0x01;HT162X_WriteData(14,DisplayMapping[14])
#define setH_0            DisplayMapping[14]&=0x0e;HT162X_WriteData(14,DisplayMapping[14])

#define setShiJian_1      DisplayMapping[16]|=0x04;HT162X_WriteData(16,DisplayMapping[16])
#define setShiJian_0      DisplayMapping[16]&=0x0b;HT162X_WriteData(16,DisplayMapping[16])


#define setM22_1          DisplayMapping[17]|=0x04;HT162X_WriteData(17,DisplayMapping[17])
#define setM22_0          DisplayMapping[17]&=0x0b;HT162X_WriteData(17,DisplayMapping[17])


#define setPM_1           DisplayMapping[17]|=0x08;HT162X_WriteData(17,DisplayMapping[17])
#define setPM_0           DisplayMapping[17]&=0x07;HT162X_WriteData(17,DisplayMapping[17])


#define setKWh_1          DisplayMapping[18]|=0x04;HT162X_WriteData(18,DisplayMapping[18])
#define setKWh_0          DisplayMapping[18]&=0x0b;HT162X_WriteData(18,DisplayMapping[18])

#define setCOL1_1         DisplayMapping[19]|=0x08;HT162X_WriteData(19,DisplayMapping[19])
#define setCOL1_0         DisplayMapping[19]&=0x07;HT162X_WriteData(19,DisplayMapping[19])


#define setP2_1           DisplayMapping[21]|=0x08;HT162X_WriteData(21,DisplayMapping[21])
#define setP2_0           DisplayMapping[21]&=0x07;HT162X_WriteData(21,DisplayMapping[21])

#define setM41_1          DisplayMapping[22]|=0x08;HT162X_WriteData(22,DisplayMapping[22])
#define setM41_0          DisplayMapping[22]&=0x07;HT162X_WriteData(22,DisplayMapping[22])

#define setM31_1          DisplayMapping[25]|=0x08;HT162X_WriteData(25,DisplayMapping[25])
#define setM31_0          DisplayMapping[25]&=0x07;HT162X_WriteData(25,DisplayMapping[25])

#define setM5_1           DisplayMapping[27]|=0x08;HT162X_WriteData(27,DisplayMapping[27])
#define setM5_0           DisplayMapping[27]&=0x07;HT162X_WriteData(27,DisplayMapping[27])


#define setP3_1           DisplayMapping[28]|=0x01;HT162X_WriteData(28,DisplayMapping[28])
#define setP3_0           DisplayMapping[28]&=0x0e;HT162X_WriteData(28,DisplayMapping[28])


#define setCOL2_1         DisplayMapping[28]|=0x02;HT162X_WriteData(28,DisplayMapping[28])
#define setCOL2_0         DisplayMapping[28]&=0x0d;HT162X_WriteData(28,DisplayMapping[28])


#define setHuiWen_1       DisplayMapping[28]|=0x04;HT162X_WriteData(28,DisplayMapping[28])
#define setHuiWen_0       DisplayMapping[28]&=0x0b;HT162X_WriteData(28,DisplayMapping[28])


#define setShiKongR_1      DisplayMapping[28]|=0x08;HT162X_WriteData(28,DisplayMapping[28])
#define setShiKongR_0      DisplayMapping[28]&=0x07;HT162X_WriteData(28,DisplayMapping[28])


#define setSuoDing_1      DisplayMapping[29]|=0x01;HT162X_WriteData(29,DisplayMapping[29])
#define setSuoDing_0      DisplayMapping[29]&=0x0e;HT162X_WriteData(29,DisplayMapping[29])


#define setM16_1          DisplayMapping[29]|=0x02;HT162X_WriteData(29,DisplayMapping[29])
#define setM16_0          DisplayMapping[29]&=0x0d;HT162X_WriteData(29,DisplayMapping[29])


#define setM12_1          DisplayMapping[29]|=0x04;HT162X_WriteData(29,DisplayMapping[29])
#define setM12_0          DisplayMapping[29]&=0x0b;HT162X_WriteData(29,DisplayMapping[29])


#define setM4_1           DisplayMapping[29]|=0x08;HT162X_WriteData(29,DisplayMapping[29])
#define setM4_0           DisplayMapping[29]&=0x07;HT162X_WriteData(29,DisplayMapping[29])


#define setM3_1           DisplayMapping[31]|=0x08;HT162X_WriteData(31,DisplayMapping[31])
#define setM3_0           DisplayMapping[31]&=0x07;HT162X_WriteData(31,DisplayMapping[31])


#define setM2_1           DisplayMapping[33]|=0x08;HT162X_WriteData(33,DisplayMapping[33])
#define setM2_0           DisplayMapping[33]&=0x07;HT162X_WriteData(33,DisplayMapping[33])


#define setM1_1           DisplayMapping[35]|=0x08;HT162X_WriteData(35,DisplayMapping[35])
#define setM1_0           DisplayMapping[35]&=0x07;HT162X_WriteData(35,DisplayMapping[35])


#define setM30_1          DisplayMapping[37]|=0x08;HT162X_WriteData(37,DisplayMapping[37])
#define setM30_0          DisplayMapping[37]&=0x07;HT162X_WriteData(37,DisplayMapping[37])


#define setAM_1           DisplayMapping[39]|=0x08;HT162X_WriteData(39,DisplayMapping[39])
#define setAM_0           DisplayMapping[39]&=0x07;HT162X_WriteData(39,DisplayMapping[39])

#define setM19_1          DisplayMapping[41]|=0x08;HT162X_WriteData(41,DisplayMapping[41])
#define setM19_0          DisplayMapping[41]&=0x07;HT162X_WriteData(41,DisplayMapping[41])


#define setP1_1           DisplayMapping[43]|=0x08;HT162X_WriteData(43,DisplayMapping[43])
#define setP1_0           DisplayMapping[43]&=0x07;HT162X_WriteData(43,DisplayMapping[43])


#define setCOL_1          DisplayMapping[45]|=0x08;HT162X_WriteData(45,DisplayMapping[45])
#define setCOL_0          DisplayMapping[45]&=0x07;HT162X_WriteData(45,DisplayMapping[45])


#define setSheDing_1      DisplayMapping[47]|=0x08;HT162X_WriteData(47,DisplayMapping[47])
#define setSheDing_0      DisplayMapping[47]&=0x07;HT162X_WriteData(47,DisplayMapping[47])


#define setShiWen_1       DisplayMapping[49]|=0x08;HT162X_WriteData(49,DisplayMapping[49])
#define setShiWen_0       DisplayMapping[49]&=0x07;HT162X_WriteData(49,DisplayMapping[49])


#define setJiaoZhun_1     DisplayMapping[50]|=0x01;HT162X_WriteData(50,DisplayMapping[50])
#define setJiaoZhun_0     DisplayMapping[50]&=0x0e;HT162X_WriteData(50,DisplayMapping[50])


#define setSuRe_1       DisplayMapping[50]|=0x02;HT162X_WriteData(50,DisplayMapping[50])
#define setSuRe_0       DisplayMapping[50]&=0x0d;HT162X_WriteData(50,DisplayMapping[50])


#define setZiDong_1         DisplayMapping[50]|=0x04;HT162X_WriteData(50,DisplayMapping[50])
#define setZiDong_0         DisplayMapping[50]&=0x0b;HT162X_WriteData(50,DisplayMapping[50])


#define setReLiang_1      DisplayMapping[50]|=0x08;HT162X_WriteData(50,DisplayMapping[50])
#define setReLiang_0      DisplayMapping[50]&=0x07;HT162X_WriteData(50,DisplayMapping[50])


#define setGongWen_1      DisplayMapping[51]|=0x01;HT162X_WriteData(51,DisplayMapping[51])
#define setGongWen_0      DisplayMapping[51]&=0x0e;HT162X_WriteData(51,DisplayMapping[51])


#define setShiKongL_1      DisplayMapping[51]|=0x02;HT162X_WriteData(51,DisplayMapping[51])
#define setShiKongL_0      DisplayMapping[51]&=0x0d;HT162X_WriteData(51,DisplayMapping[51])


#define setKaiDu_1        DisplayMapping[51]|=0x04;HT162X_WriteData(51,DisplayMapping[51])
#define setKaiDu_0        DisplayMapping[51]&=0x0b;HT162X_WriteData(51,DisplayMapping[51])


#define setShangXian_1    DisplayMapping[51]|=0x08;HT162X_WriteData(51,DisplayMapping[51])
#define setShangXian_0    DisplayMapping[51]&=0x07;HT162X_WriteData(51,DisplayMapping[51])
#endif // __Display_h__

